﻿using System;
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace Entity.Migrations
{
    /// <inheritdoc />
    public partial class Init : Migration
    {
        /// <inheritdoc />
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.AlterDatabase()
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "AA001",
                columns: table => new
                {
                    P01 = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
                    AA02 = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: true)
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    LastName = table.Column<string>(type: "longtext", nullable: false)
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    FirstName = table.Column<string>(type: "longtext", nullable: false)
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    P02 = table.Column<bool>(type: "tinyint(1)", nullable: false),
                    P03 = table.Column<bool>(type: "tinyint(1)", nullable: false),
                    P04 = table.Column<DateTime>(type: "datetime(6)", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_AA001", x => x.P01);
                })
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "Enroll",
                columns: table => new
                {
                    P01 = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
                    Money = table.Column<int>(type: "int", nullable: false),
                    ddres = table.Column<string>(type: "longtext", nullable: true)
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    P011 = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
                    LastName = table.Column<string>(type: "longtext", nullable: false)
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    FirstName = table.Column<string>(type: "longtext", nullable: false)
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    P02 = table.Column<bool>(type: "tinyint(1)", nullable: false),
                    P03 = table.Column<bool>(type: "tinyint(1)", nullable: false),
                    P04 = table.Column<DateTime>(type: "datetime(6)", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Enroll", x => x.P01);
                    table.ForeignKey(
                        name: "FK_Enroll_AA001_P011",
                        column: x => x.P011,
                        principalTable: "AA001",
                        principalColumn: "P01");
                })
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.InsertData(
                table: "AA001",
                columns: new[] { "P01", "P04", "FirstName", "P03", "P02", "LastName", "AA02" },
                values: new object[] { new Guid("0040f3f2-08d5-45f4-ae00-5f5064bec2b6"), new DateTime(2025, 3, 26, 8, 56, 24, 251, DateTimeKind.Local).AddTicks(1810), "zhangsan", false, false, "san", null });

            migrationBuilder.CreateIndex(
                name: "IX_Enroll_P011",
                table: "Enroll",
                column: "P011");
        }

        /// <inheritdoc />
        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropTable(
                name: "Enroll");

            migrationBuilder.DropTable(
                name: "AA001");
        }
    }
}
